<?php

require_once 'Zend/Auth/Result.php';


class App_Auth_Adapter implements Zend_Auth_Adapter_Interface {
	
	private $login;
	private $passwd;
	function __construct($login, $passwd) {
		$this->login = $login;
		$this->passwd = $passwd;
	}
	
	public function authenticate() {
		global $config;//print_r($config);exit();
		if (($this->login==$config[admin][login])&&($this->passwd==$config[admin][passwd]))
			return new Zend_Auth_Result(Zend_Auth_Result::SUCCESS, 0, array('Authentication successful.'));
		else 
			return new Zend_Auth_Result(Zend_Auth_Result::FAILURE, 0, array('Authentication unsuccessful.'));
	}
	
	public function getData($login) {
		$obj = new stdClass();
		$obj->login = $login;
		$obj->name = "admin";
		return $obj;
	}
}